﻿<%@ Page Language="C#" AutoEventWireup="true"
    Inherits="EZCRS.HCMS.Web.manage.AIR.calendar_report" Codebehind="calendar_report.aspx.cs" %>

<%@ Register Src="../usercontrol/titlepage.ascx" TagName="titlepage" TagPrefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link type="text/css" href="../../Style/default.css" rel="Stylesheet" />

    <script src="../../Common/jquery-1.2.6.min.js"></script>

 

    <script>

        var level;

        $(document).ready(function() {


            $("#ddlLevel").change(function() {

                $("#ddlLevel option:selected").each(function() {
                    if ($(this).val() == "P") {
                        $('#div_room').hide();
                        $('#div_plan').hide();

                        level = "P";
                    }
                    else if ($(this).val() == "L") {
                        $('#div_room').hide();
                        $('#div_plan').show();

                        level = "L";
                    }
                    else {
                        $('#div_room').show();
                        $('#div_plan').hide();
                    }
                });


            }).change();

            $('#info').hide();
            $('#inventory').hide();

            $('#info .close_button').click(function() {
                $('#info').fadeOut(200);
            });

            $('#inventory .close_button').click(function() {
                $('#inventory').fadeOut(200);
            });

            $('.calendar_warp .a_rate').click(function() {

                var args = $('#hidValue').val();

                var offset = $(this).offset();

                $('#info').css('left', offset.left + 10);
                $('#info').css('top', offset.top + 10);

                showLoading();

                $.getJSON("?action=get&type=1&args=" + args + "," + $(this).attr("rel"),

                    function(data) {
                        showRate(data);
                    }
                );

                return false;
            });


            $('.calendar_warp .a_ai').click(function() {

                var args = $('#hidValue').val();

                var offset = $(this).offset();

                $('#inventory').css('left', offset.left + 10);
                $('#inventory').css('top', offset.top + 10);

                showInventoryLoading();

                $.getJSON("?action=get&type=0&args=" + args + "," + $(this).attr("rel"),

                    function(data) {
                        showAI(data);
                    }
                );

                return false;
            });

            $('.month').click(function() {

                $('#info').fadeOut(200);
                $('#inventory').fadeOut(200);
            });

        });

        function showLoading() {

            $('#info_content').html("Loading...");

            $('#info').fadeIn(200);
        }

        function showInventoryLoading() {

            $('#inventory_content').html("Loading...");

            $('#inventory').fadeIn(200);
        }

        function showRate(data) {

            //get data
            var html = '<h2>日期:' + data.Date + ' 价格信息</h2>';

            html += "<table><tr>" +
                    "<td>单人价:</td>" +
                    "<td>" + data.rate1 + "</td>" +
                "</tr>" +

                "<tr>" +
                    "<td>双人价:</td>" +
                    "<td>" + data.rate2 + "</td>" +
                "</tr>" +

                "<tr>" +
                    "<td>三人价:</td>" +
                    "<td>" + data.rate3 + "</td>" +
                "</tr>" +

                "<tr>" +
                    "<td>四人价:</td>" +
                    "<td>" + data.rate4 + "</td>" +
                "</tr>" +

                "<tr>" +
                    "<td>加床价:</td>" +
                    "<td>" + data.bed + "</td>" +
                "</tr>" +

                "<tr>" +
                    "<td>含早餐:</td>" +
                    "<td>" + data.hasBF + "</td>" +
                "</tr>" +

                "<tr>" +
                    "<td>早餐价:</td>" +
                    "<td>" + data.BFrate + "</td>" +
                "</tr>" +

                "<tr>" +
                    "<td>早餐数:</td>" +
                    "<td>" + data.BFnum + "</td>" +
                "</tr>" + "</table>";

            //alert(html);
            //$('#').attr();

            $('#info_content').html(html);

        }

        function showAI(data) {

            //get data
            var html = '<h2>日期:' + data.Date + ' 房量信息</h2>';

            html += "<table>";

            if (level != "P") {
                html +=
                    "<tr>" +
                        "<td>房量:</td>" +
                        "<td>" + data.inventory + "</td>" +
                    "</tr>" +
                    "<tr>" +
                        "<td>剩余:</td>" +
                        "<td>" + data.curinv + "</td>" +
                    "</tr>";
            }

            html +=
                "<tr>" +
                    "<td>状态:</td>" +
                    "<td>" + data.state + "</td>" +
                "</tr>" +
                "<tr>" +
                    "<td>最小入住天数:</td>" +
                    "<td>" + data.min + "</td>" +
                "</tr>" +
                "<tr>" +
                    "<td>最大入住天数:</td>" +
                    "<td>" + data.max + "</td>" +
                "</tr>" +
                "<tr>" +
                    "<td>提前预订小时:</td>" +
                    "<td>" + data.adv + "</td>" +
                "</tr>";

            if (level == "L") {
                html += "<tr>" +
                    "<td>保证金制度:</td>" +
                    "<td>" + data.gua + "</td>" +
                "</tr>" +
                "<tr>" +
                    "<td>取消制度:</td>" +
                    "<td>" + data.cxl + "</td>" +
                "</tr>";
            }

            html += "</table>";

            $('#inventory_content').html(html);

        }	    
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <uc2:titlepage ID="Titlepage1" runat="server" inittitle="<%$ Resources:Site, AIR %>">
    </uc2:titlepage>
    <div id="info" class="div_info">
        <span class="close_button"><a href="javascript:void(0);">X</a></span> <span id="info_content">
        </span>
    </div>
    <div id="inventory" class="div_info">
        <span class="close_button"><a href="javascript:void(0);">X</a></span> <span id="inventory_content">
        </span>
    </div>

<table align="center" border="0" cellspacing="0" cellpadding="0" class="main-table">
                                    <tr>
                                        <th class="minfo-title">
                                            酒店计划日历
                                        </th>
                                    </tr>
                                    <tr>
                                        <td>
                                            级别：<asp:DropDownList ID="ddlLevel" runat="server">
                                                <asp:ListItem Value="P">酒店级</asp:ListItem>
                                                <asp:ListItem Value="R">房间级</asp:ListItem>
                                                <asp:ListItem Value="L">计划级</asp:ListItem>
                                            </asp:DropDownList>
                                            &nbsp;<asp:Button ID="btnSearch" runat="server" CssClass="button" Text="查询" OnClick="btnSearch_Click" />
                                            <br />
                                            <div id="div_room">
                                                房型：<asp:DropDownList ID="ddlRoomType" runat="server">
                                                </asp:DropDownList>
                                            </div>
                                            <div id="div_plan">
                                                计划：<asp:DropDownList ID="ddlPlan" runat="server">
                                                </asp:DropDownList>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblYearTitle" runat="server" Text="年份："></asp:Label>
                                            <asp:Button ID="btnPrv" runat="server" Text="<<" OnClick="btnPrv_Click" CssClass="button" />
                                            <asp:Label ID="lblYear" runat="server" Text=""></asp:Label>
                                            <asp:Button ID="btnNext" runat="server" Text=">>" OnClick="btnNext_Click" CssClass="button" />
                                            <asp:Literal ID="litHtml" runat="server"></asp:Literal>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:HiddenField ID="hidValue" runat="server" />
                                        </td>
                                    </tr>
                                     <tr>
                                        <td>
                                           
                                        </td>
                                    </tr>
                                </table>
<p></p>
    </form>
</body>
</html>
